﻿using System;

namespace TimeWork
{
    public partial class ChangeProfile : System.Web.UI.Page
    {
        //public string Email { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Session["email"] != null)
            //{
            //    this.Email = Session["email"].ToString();
            //    EnStaff staffExist = getStaff();
            //    if (!IsPostBack)
            //    {

            //        LblId.Text = "NV." + staffExist.positionStandFor + "." + staffExist.id;
            //        LblEmail.Text = staffExist.email;
            //        LblPosition.Text = staffExist.positionName;

            //        TxtFullName.Text = staffExist.fullName;
            //        TxtBirthday.Text = staffExist.birthday.ToString("dd/MM/yyyy");
            //        TxtCurrentAddress.Text = staffExist.currentAddress;
            //        TxtLevel.Text = staffExist.level.ToString();
            //        TxtPhoneNumber.Text = staffExist.phoneNumber;
            //        TxtScale.Text = staffExist.scale;

            //        bool gender = staffExist.gender;
            //        if (gender)
            //        {
            //            DdlGender.SelectedValue = "1";
            //        }
            //        else
            //        {
            //            DdlGender.SelectedValue = "0";
            //        }
            //    }
            //}
            //else
            //{
            //    Response.Redirect("http://"+Request.Url.Authority+"/Login.aspx");
            //}
        }

        //public EnStaff getStaff()
        //{
        //    return BuStaff.GetStaffByEmail(this.Email);
        //}

        //protected void BtnCancel_Click(object sender, EventArgs e)
        //{
        //    Response.Redirect("Dashboard.aspx");
        //}

        //protected void BtnUpdate_Click(object sender, EventArgs e)
        //{
        //    EnStaff staff = new EnStaff();
        //    try
        //    {
        //        staff.email = this.Email;
        //        staff.fullName = TxtFullName.Text.ToString();
        //        staff.birthday = DateTime.ParseExact(TxtBirthday.Text.ToString(), "dd/MM/yyyy", null);
        //        staff.scale = TxtScale.Text.ToString();
        //        staff.level = Int32.Parse(TxtLevel.Text);

        //        bool genderTmp = DdlGender.SelectedValue.Equals("1")?true:false;

        //        staff.gender = genderTmp;
        //        staff.phoneNumber = TxtPhoneNumber.Text.ToString();
        //        staff.currentAddress = TxtCurrentAddress.Text.ToString();
        //    }
        //    catch
        //    {
        //        // Loi nhap lieu
        //    }
        //    BuStaff.UpdateStaff(staff);
        //    Response.Redirect("Dashboard.aspx");
        //}
    }
}